<?PHP

error_reporting(E_ALL);
// $Id: Exp$

/**
 * DpList Class.
 *
 *
 *  <p>OO list display class.</p>
 *
 * <p>Use the AddRow method to accumulate list information,
 * or set them all with SetRows.</p>
 * <p>Use the StyleId property to assign the CSS Style Id.</p>
 */


class DpList
{
    private $_rows       = array();  // Array for rows e.g. resultset.
    private $_style_class;

    /**
     * Constructor.  No arguments.
     * Public.
     */

    public function DpList($styleclass = null)
    {
        $this->_style_class = $styleclass;
    }

    /**
     * setRows. Argument is resultset-type array (colname => value).
     * Public.
     */

    public function SetRows($rows)
    {
        $this->_rows = $rows;
    }

    /**
     * addColumn.  Now an instance of DpTableColumn,
     * which see for arguments.
     * Public.
     */

    public function AddRow($rowval)
    {
        $this->_rows[] = $rowval;
    }

    public function SetStyleId($styleid)
    {
        $this->_style_class = $styleid;
    }

    /**
     * echo. Generate the list.
     * Public.
     */

    public function EchoList($indent = 1)
    {
        echo "<ul" . empty($this->_style_class)
                ? ""
                : "class='{$this->_style_class}'>\n";

        foreach($this->_rows as $row) {
            echo "<li>$row</li>\n";
        }

        echo "</ul>\n";
    }
}

private function _dp_list_link($caption, $url, $args)
{
    return "<a href=\"$url$args>$caption</a>\n";
}
?>
